<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>盆栽商店</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="eCommerce HTML Template Free Download" name="keywords">
    <meta content="eCommerce HTML Template Free Download" name="description">

    <!-- Favicon -->
    <link href="img/favicon.ico" rel="icon">

    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400|Source+Code+Pro:700,900&display=swap" rel="stylesheet">

    <!-- CSS Libraries -->
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
    <link href="lib/slick/slick.css" rel="stylesheet">
    <link href="lib/slick/slick-theme.css" rel="stylesheet">

    <!-- Template Stylesheet -->
    <link href="css/product-detail.css" rel="stylesheet">
    <link href="css/autoComplete.css" rel="stylesheet" type="text/css">
</head>

<body>
<!-- Top bar Start -->
<div class="top-bar">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">
                <i class="fa fa-envelope"></i>
                CSU
            </div>
            <div class="col-sm-6">
                <i class="fa fa-phone-alt"></i>
                400-114514
            </div>
        </div>
    </div>
</div>
<!-- Top bar End -->

<!-- Nav Bar Start -->
<div class="nav">
    <div class="container-fluid">
        <nav class="navbar navbar-expand-md bg-dark navbar-dark">
            <a href="#" class="navbar-brand">MENU</a>
            <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse justify-content-between" id="navbarCollapse">
                <div class="navbar-nav mr-auto">
                    <a href="welcome" class="nav-item nav-link active">主页</a>
                    <a href="category?categoryId=cat" class="nav-item nav-link" id="cat">花本植物</a>
                    <a href="category?categoryId=dog" class="nav-item nav-link" id="dog">木本植物</a>
                    <a href="category?categoryId=bird" class="nav-item nav-link" id="bird">草本植物</a>
                    <a href="category?categoryId=pokemon" class="nav-item nav-link" id="pokemon">多肉植物</a>
                    <a href="category?categoryId=bugCat" class="nav-item nav-link" id="bugCat">景观植物</a>
                </div>
                <div class="navbar-nav ml-auto">
                    <a href="cart" class="nav-item nav-link">购物车</a>
                    <!--用户是否登录-->
                    <c:if test="${sessionScope.username != null}">
                        <a href="space" class="nav-item nav-link">用户中心</a>
                    </c:if>
                    <c:if test="${sessionScope.username == null}">
                        <a href="login" class="nav-item nav-link">欢迎登录</a>
                    </c:if>
                </div>
            </div>
        </nav>
    </div>
</div>
<!-- Nav Bar End -->

<!-- Bottom Bar Start -->
<div class="bottom-bar">
    <div class="container-fluid">
        <div class="row align-items-center">
            <div class="col-md-3">
                <div class="logo">
                    <a href="welcome">
                        <img src="image/mainPage/logo.png" alt="Logo">
                    </a>
                </div>
            </div>
            <div class="col-md-6">
                <form action="Search" method="post">
                    <div class="search">
                        <input type="text" placeholder="搜索想要的盆栽吧" name="searchName" id="searchName">
                        <button><i class="fa fa-search"></i></button>
                    </div>
                    <!--自动补全-->
                    <div id="autoComplete" class="searchComp">
                        <li id="autoCompleteLi">
                        </li>
                    </div>
                </form>
            </div>
            <div class="col-md-3">
                <div class="user">

                    <a href="cart" class="btn cart">
                        <i class="fa fa-shopping-cart"></i>
                        <span id="cartNumberSpan">(0)</span>
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Bottom Bar End -->

<!-- Login Start -->
<div class="login">
    <div class="container-fluid">
        <div class="row">
            <div class="col-lg-6">
                <div class="register-form">
                    <form action="signupServlet" method="post" class="col-lg-6" id="signUp-from-label">
                    <div class="row">
                        <div class="col-md-6">
                            <label>昵称</label>
                            <input class="form-control" type="text" placeholder="昵称" name="username" id="username">
                        </div>
                        <!-- <div class="col-md-6">
                            <label>Last Name"</label>
                            <input class="form-control" type="text" placeholder="Last Name">
                        </div> -->
                        <div class="col-md-6">
                            <label>邮箱</label>
                            <input class="form-control" type="text" placeholder="邮箱">
                        </div>
                        <div class="col-md-6">
                            <label>电话号码</label>
                            <input class="form-control" type="text" placeholder="电话号码">
                        </div>
                        <div class="col-md-6">
                            <label>密码</label>
                            <input class="form-control" type="text" placeholder="密码" name="password" id="password">
                        </div>
                        <div class="col-md-6">
                            <label>再输入密码</label>
                            <input class="form-control" type="text" placeholder="再输入密码" name="repassword" id="repassword">
                        </div>
                        <c:if test="${requestScope.signupMsg == null}">
                            <div class="col-md-6">
                                <label style="color: red" id="tips"></label>
                            </div>
                        </c:if>
                        <c:if test="${requestScope.signupMsg != null}">
                            <div class="col-md-6">
                                <label style="color: red">${requestScope.signupMsg}</label>
                            </div>
                        </c:if>
                        <div class="col-md-12">
                            <button class="btn" onclick="onSignUpClick()">注册</button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>

            <div class="col-lg-6">
                <div class="login-form">
                    <form action="loginServlet" method="post" class="col-lg-6">
                    <div class="row">
                            <div class="col-md-6">
                                <label>用户名</label>
                                <input class="form-control" type="text" placeholder="邮箱 / 昵称" name="username">
                            </div>
                            <div class="col-md-6">
                                <label>密码</label>
                                <input class="form-control" type="text" placeholder="密码" name="password">
                            </div>
                            <div class="col-md-12">
                                <div class="custom-control custom-checkbox">
                                    <input type="checkbox" class="custom-control-input" id="newaccount">
                                    <label class="custom-control-label" for="newaccount">保持登陆状态</label>
                                </div>
                            </div>
                            <c:if test="${requestScope.loginMsg != null}">
                                <div class="col-md-6">
                                    <label style="color: red">用户名或密码错误!</label>
                                </div>
                            </c:if>
                            <div class="col-md-12">
                                <button class="btn" type="submit">登陆</button>
                            </div>
                    </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
<!-- Login End -->

<!-- Call to Action Start -->
<div class="call-to-action">
    <div class="container-fluid">
        <div class="row align-items-center">
            <div class="col-md-6">
                <h1>遇到问题?立即联系我们</h1>
            </div>
            <div class="col-md-6">
                <a href="tel:0123456789">400-114514</a>
            </div>
        </div>
    </div>
</div>
<!-- Call to Action End -->

<!-- Footer Bottom Start -->
<div class="footer-bottom">
    <div class="container">
        <div class="row">
            <div class="col-md-6 copyright">
                <p>Supported By &copy; <a href="https://csu.edu.cn">CSU</a>. </p>
            </div>

            <div class="col-md-6 template-by">
                <p>Powered By <a href="https://csu.edu.cn">CSUer</a></p>
            </div>
        </div>
    </div>
</div>
<!-- Footer Bottom End -->

<!-- Back to Top -->
<a href="#" class="back-to-top"><i class="fa fa-chevron-up"></i></a>

<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="lib/easing/easing.min.js"></script>
<script src="lib/slick/slick.min.js"></script>

<!-- Template Javascript -->
<script src="javascripts/main.js"></script>
<script src="javascripts/signUpCheck.js"></script>
<script src="javascripts/cartNum.js"></script>
<script src="javascripts/autoComplete.js"></script>
<script>
    function showInfo(){
        var signMsg='${requestScope.signupMsg}';
        if(signMsg === '注册成功'){
            window.alert('注册成功，欢迎登录!');
        }
        return;
    }
    showInfo();
</script>
</body>
</html>
